package com.ac.scum.log.task.face.log.counsumer;

import com.ac.scum.log.task.face.log.counsumer.stages.*;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Slf4j
@Component
@AllArgsConstructor
public class LogTypeStage {

    public Map<String, LogConsumer> stage;

    @Autowired
    public void setStage(AdminLogConsumer adminLogConsumer
            , ChatLogConsumer chatLogConsumer
            , KillLogConsumer killLogConsumer
            , LoginLogConsumer loginLogConsumer
            , EconomyLogConsumer economyLogConsumer
            , VehicleLogConsumer vehicleLogConsumer
            , GameplayLogConsumer gameplayLogConsumer
            , ViolationsLogConsumer violationsLogConsumer
            , ChestOwnershipLogConsumer chestOwnershipLogConsumer
    ) {
        stage = Map.of(
                "chat", chatLogConsumer,
                "kill", killLogConsumer,
                "admin", adminLogConsumer,
                "login", loginLogConsumer,
                "event_kill", killLogConsumer,
                "economy", economyLogConsumer,
                "gameplay", gameplayLogConsumer,
                "violations", violationsLogConsumer,
                "vehicle_destruction", vehicleLogConsumer,
                "chest_ownership", chestOwnershipLogConsumer
        );
    }

    public LogConsumer getStage(String logName) {
        return stage.get(logName.substring(0, logName.lastIndexOf("_")));
    }
}
